
// java date ==> js date ==> js timestamp
function time_util(time_up) {
    let up_time = new Date(time_up).valueOf()
    let curr_time = new Date().valueOf()
    let total_time = curr_time - up_time
    if (total_time < 60 * 1000) return "1分钟前"
    if (total_time < 60 * 60 * 1000) return Math.ceil(total_time / (60 * 1000)) + "分钟前"
    if (total_time < 24 * 60 * 60 * 1000) return Math.ceil(total_time / (60 * 60 * 1000)) + "小时前"
    return Math.ceil(total_time / (24 * 60 * 60 * 1000)) + "天前"
}


export {
    time_util
}